package com.nuoniu.sibanyun.service.finance;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nuoniu.sibanyun.entity.dto.AccountingLedgerDto;
import com.nuoniu.sibanyun.entity.finance.VAccountingLedger;
import com.nuoniu.sibanyun.entity.finance.VAccountingSearchProgramme;
import com.nuoniu.sibanyun.entity.finance.VAccountingVoucherDetail;
import com.nuoniu.sibanyun.entity.finance.VAssetsLiabilitiesFormula;
import com.nuoniu.sibanyun.entity.vo.VAccountingLedgerVo;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 科目总账 服务类
 * </p>
 *
 * @author 小啊刚
 * @since 2021-04-25
 */
public interface IVAccountingLedgerService extends IService<VAccountingLedger> {

    /**
     * 记录辅助总账
     * @author 小啊刚
     * @date 2021-04-25
     */
    void saveAccounting(List<VAccountingVoucherDetail> voucherDetails);

    /**
     * 保存
     * @author 小啊刚
     * @date 2021-04-28
     */
    Map<String, Object> saveLedger(List<VAccountingLedgerVo> accountingLedger);

    Integer getByAccountingId(Long id);

    /**
     * 科目期初余额列表
     * @author 小啊刚
     * @date 2021-05-06
     */
    List<VAccountingLedgerVo> getList(Integer accountingTypeId, String name, String code);

    /**
     * 发生额及科目余额表
     * @author 小啊刚
     * @date 2021-05-10
     */
    Page<VAccountingLedger> pageEndAccountingList(Page page, VAccountingSearchProgramme searchProgramme);

    /**
     * 总分类账
     * @author 小啊刚
     * @date 2021-05-10
     */
    Page<AccountingLedgerDto> getGeneralLedgerList(Page page, VAccountingSearchProgramme searchProgramme, Boolean isShowDetail, Boolean isDayBook);

    /**
     * 总分类明细账
     * @author 小啊刚
     * @date 2021-05-11
     */
    Page<AccountingLedgerDto> getGeneralDetailLedgerList(Page page, VAccountingSearchProgramme searchProgramme);

    /**
     * 获取总账期初
     * @author 小啊刚
     * @date 2021-05-24
     */
    List<VAccountingLedger> getList(Integer companyId, Integer accountYear);

    /**
     * 获取科目期初
     * @author 小啊刚
     * @date 2021-05-25
     */
    VAccountingLedger getById(Integer accountingId, Integer accountYear, int period);

    /**
     * 获取科目总账
     * @author 小啊刚
     * @date 2021-05-28
     */
    List<VAccountingLedger> getAccountingLedger(String code, Integer accountPeriod);

    /**
     * 期末余额
     * @author 小啊刚
     * @date 2021-05-31
     */
    BigDecimal getFinalBalance(Integer accountingId, Integer accountYear, Integer accountPeriod);

    /**
     * 获取年度余额
     * @author 小啊刚
     * @date 2021-06-01
     */
    VAccountingLedger getYearBalance(Integer accountingId, Integer accountYear, Integer accessRule);

    void countFormula(VAssetsLiabilitiesFormula a, Integer accountYear);

    /**
     * 期初试算平衡
     * @author 小啊刚
     * @date 2022-05-06
     */
    Map<String, Double> trialBalance();

    Integer getAccountPeriod(Integer accountYear, Integer companyId);
}
